<!--  -->
<template>
  <div>sm加密
    <div>
      {{text}}
    </div>
    <div style="width:900px;word-wrap: break-word;">
      {{enText}}
    </div>
    <div>
      {{deText}}
    </div>
  </div>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,onMounted} from 'vue'
import { useCryptoStore} from "@/store";
import {sm2,sm3,sm4} from 'sm-crypto'

const cryptoStore=useCryptoStore();

const text=ref("123456");
const enText=ref("");

const deText=ref("");
//公钥
// let publicKey="";
// //私钥
// let privateKey = "";

//生成默认的公钥 和私钥
// let keypair = sm2.generateKeyPairHex();
// console.log(keypair);

// publicKey=keypair.publicKey;
// privateKey=keypair.privateKey;

// console.log(publicKey.length);


// cryptoStore.doEncrypt(text.value).then(res=>{

//   enText.value=res;
// })

 



// //加密
// enText.value= sm2.doEncrypt(text.value,publicKey);

// //解密
// deText.value=sm2.doDecrypt(enText.value,privateKey)



</script>
<style scoped>
</style>